#{extends 'main.html' /}
#{set 'moreScripts'}



<link rel="stylesheet" href="@{'/public/stylesheets/forms.css'}">

<link rel="stylesheet" href="@{'/public/stylesheets/css3buttons.css'}">


<script type="text/javascript"
	src="@{'/public/javascripts/FancyBox/jquery.fancybox-1.3.4.pack.js'}"></script>

<link rel="stylesheet" type="text/css"
	href="@{'/public/stylesheets/jquery.fancybox-1.3.4.css'}"
	media="screen">

<script type="text/javascript"
	src="@{'/public/javascripts/FancyBox/jquery.easing-1.3.pack.js'}"></script>

<script type="text/javascript"
	src="@{'/public/javascripts/FancyBox/jquery.mousewheel-3.0.4.pack.js'}"></script>

<script type="text/javascript">
jQuery(document).ready(function() {

	jQuery("#controlpanel").fancybox({
			'width' : '80%',
			'height' : '100%',
			'autoScale' : true,
			'transitionIn' : 'none',
			'transitionOut' : 'none',
			'type' : 'iframe',
			'onClosed': function() {
				    parent.location.reload(true); ;
				  }
		});

	});
</script>


#{/set}
<div id=main>
	#{if userEntry==false} </br> You should join the organization to be able to
	view it's entities
	<li><a
		href="@{Organizations.showOrganization(topicOrganization.id)}">Go
			to Organization</a></li> #{/if}
 #{else}
	<div id="right">

	<p class="field">
		<label>Topic author: </label> ${topic.author.name}
	</p>
	<p class="field">
		<label>Topic title: </label> ${topic.title}
	</p>
	<p class="field">
		<label>Description: </label> ${topic.body}
	</p>
	<p class="field">
		<label>Topic posted on: </label> ${topic.postedAt}
	</p>
	<p>


		#{if user.email==topic.author.email} <br />
			<p><b> Topic is tagged in :
#{if topic.tags}
#{list items:topic.tags, as:'tag'}
<ul>
<li><a href="@{Tags.ShowTag(tag.id)}">${tag.name} </a><a href="@{Tags.unTagSuccess(tagString,tag.id)}" class=" pill button"></span>UnTag Topic</a>
</a></li>
</ul>
#{/list}
#{/if}
#{else}
No Tags !!
#{/else}
</b></p>

<p><b>Organization Tags that Topic is not tagged in:
#{if tagsTopicNotTaggedIn}
#{list items:tagsTopicNotTaggedIn, as:'tag'}
<ul>
<li><a href="@{Tags.ShowTag(tag.id)}">${tag.name} </a><a href="@{Tags.tagSuccess(tagString,tag.id)}" class=" pill button"></span>Tag Topic</a>
</a></li>
</ul>
#{/list}
#{/if}
#{else}
No Tags !!
#{/else}

</b></p>
			
		#{/if}
		#{elseif user.email==topic.entity.organization.lead.email} <a
			href="@{Topics.executeTopic(topic.id,topic.entity.id)}" class="pill button">ExecuteTopic</a><br />
		#{/elseif}
		#{else}you cannot execute this topic#{/else}<br />
		#{if inSubscriber==false} <a href="@{Topics.addSubscriber(topic.id)}"
			class="pill button">Follow Topic</a><br /> #{/if} #{if inSubscriber==true} <a
			href="@{Topics.removeSubscriber(topic.id)}" class="pill button">Unfollow Topic</a><br />
		#{/if} 
			
			#{if authorized}
			 <a id=status href="javascript: unlockTopic()" class="pill button">Unlock Topic</a><br />
		 
		
		#{/if}


	</p>
	#{if user!=topic.author}
	#{if isSpammed == false}
	<p class="field">
		<a href="@{Topics.showTopicSpam(topic.id)}" class="pill button"
			onclick="alert ('The Topic has been spammed');">Mark as spam </a>
	</p>
	#{/if} #{else}
	<p class="field">
		<a href="" class="pill button"
			onclick="alert ('This topic is already flagged !');">Mark as spam </a>
	</p>
	#{/else} #{/if}<br>
	<li><a
			href="javascript: jQuery.facebox({ajax:'@{PostingIdea.showTopicIdeas(topic.id)}'});">Show
				Topic Ideas</a></li> <br />


	<li><a
			href="javascript: jQuery.facebox({ajax:'@{PostingIdea.Post(topic.id)}'});">Post
				Idea To Topic</a></li>
	
	
	<a href="@{Topics.listOfAllTopics(topic.entity.id)}"class="pill button"> Back
			to topics</a><br>
	
	 #{if topic.hide==false}#{if permit}<a
				href="@{Topics.justificationNote(topic.id)}"class="pill button"
				onclick="return confirm ('Are you sure you want to hide this topic?');">
					Hide Topic </a>#{/if}#{/if}<br>
							<a href="@{Entity.viewEntity(topic.entity.id)}"class="pill button"> Back </a><br>
</div>
	
	#{/else}
</div>